<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>


<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>频道标签管理</title>
<style type="text/css">
    .l-table-edit {font-size: 12px;margin: auto; width:100%; border-collapse:collapse;}
 	.l-table-edit td{ padding:4px;border:1px solid #336699;}
</style>
</head>

	<table  class="l-table-edit">
		<tr>
			<td width=20%>频道</td>
			<td width=60%> 标签  </td>
			<td width=20%>   <input type="button"  value="添加新标签" onclick="addTag()"/>  </td>
		</tr>
		<c:forEach items="${channel}" var="chel">
			<tr>
				<td > 
					<c:if test="${chel=='c1fd788e-590b-4579-b5ef-d21a9f42c92d'}">怀孕期</c:if>
					 <c:if test="${chel=='5e02f483-87bd-4d77-81d5-a64ecdc877d0'}">0-1岁</c:if>
					<c:if test="${chel=='1d48a3b9-3709-4270-81b5-0267a5b3546f'}">1-3岁</c:if>
					<c:if test="${chel=='b22c5b02-baa2-42de-ac92-09042e8ccfa2'}">3-6岁</c:if>
				</td>
						<td >
						<c:forEach items="${disTagList }" var="tags">
							<c:if test="${tags.channel==chel}">
								   <a href="javascript:void(0);" onclick="operateTag('${tags.identifier}');">${tags.name}</a>&nbsp;| 
							</c:if>
						</c:forEach>
						</td>
				<td >       
				</td>
			</tr>	
		</c:forEach>
	</table>
	
	<div style="display: none" id="addTag">
		<table  class="l-table-edit">
			<tr>
				<td>
				 频道 <select id="channel">
				 	 <option value="01">请选择</option>
				 	  <option value="c1fd788e-590b-4579-b5ef-d21a9f42c92d">怀孕期</option>
				 	  <option value="5e02f483-87bd-4d77-81d5-a64ecdc877d0">0-1岁</option>
				 	  <option value="1d48a3b9-3709-4270-81b5-0267a5b3546f">1-3岁</option>
				 	  <option value="b22c5b02-baa2-42de-ac92-09042e8ccfa2">3-6岁</option>
				     </select>
				</td>
				<td>
					标签名称：<input type="text" id="name"/>
				</td>
				<td>
				  <input type="button" value="确定保存" onclick="saveTag();"/>
				</td>
			</tr>
		</table>
	</div>
	
	<script type="text/javascript">
		function addTag(){
			$("#addTag").show();
		}
		function saveTag(){
			var channel= $("#channel").val();
			if(channel=='01'){
				alert("请选择频道！");
			}else{
				$.post("savaDisTag.htm", {
					'channel' : $("#channel").val(),
					'name':$("#name").val()
				}, function(data) {
					window.location.href="/misc/discuss/discusstag.htm";
				});
			}
		}
		function operateTag(id){
			$.ligerDialog.confirm('你确定删除麼？', 
					function (yes){
						if(yes){
							$.post("/misc/discuss/deleteDisTag.htm",{tagId:id},
								function(data){
									alert("删除成功");
									window.location.href="/misc/discuss/discusstag.htm";
								}
							); 
						}
					})
		}
	</script>
